﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using NFLManager.Properties;

namespace NFLManager
{
    class Logs
    {

        protected static Logs _logs = null;

        protected Logs() { }

        public static Logs Istance
        {
            get { return _logs ?? (_logs = new Logs()); }
        }

        public void LogException(string function, string url, Exception e, string dtTitle = null, int row = 0, int col = 0)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(Properties.Settings.LOGS_PATH + "log.txt", true))
            {
                file.WriteLine(
                    string.Format("\n\n!!!ECCEZIONE!!!\ndate -> {0} \ncalling -> {1}  \nurl -> {2} \ndescrizione -> {3} \nDataTable -> {4} \nriga -> {5} \ncolonna -> {6}",
                                  DateTime.Now,
                                  function,
                                  url,
                                  dtTitle,
                                  row,
                                  col,
                                  e.Message
                                  ));
            }
        }


    }
}
